//
//  AXFEmptyShoppingCartView.m
//  爱鲜蜂
//
//  Created by HH on 16/11/23.
//  Copyright © 2016年 胡浩. All rights reserved.
//

#import "AXFEmptyShoppingCartView.h"

@implementation AXFEmptyShoppingCartView

- (void)setupUI
{
    self.backgroundColor = [UIColor cz_colorWithHex:0xf6f6f6];
    
    //购物车
    UIImageView *shopEmptView = [[UIImageView alloc] init];
    
    UIImage *image = [UIImage imageNamed:@"v2_shop_empty"];
    
    shopEmptView.image = image;
    
    shopEmptView.layer.cornerRadius = 45;
    
    shopEmptView.clipsToBounds = YES;
    
    [self addSubview:shopEmptView];
    
    //描述
    UILabel *reminderLabel = [UILabel cz_labelWithText:@"亲,购物车空空的耶~赶紧去挑好吃的吧" fontSize:16 color:[UIColor cz_colorWithHex:0x878787]];
    
    reminderLabel.textAlignment = NSTextAlignmentCenter;
    
    [self addSubview:reminderLabel];
    
    //去逛逛
    UIButton *goShoppingBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    
    [goShoppingBtn setTitle:@"去逛逛" forState:UIControlStateNormal];
    
    [goShoppingBtn setTitleColor:[UIColor cz_colorWithHex:0x878787] forState:UIControlStateNormal];
    
    [goShoppingBtn.layer setBorderWidth:1.0];
    
    [goShoppingBtn.layer setBorderColor:[UIColor cz_colorWithHex:0xe8e8e8].CGColor];
    
    goShoppingBtn.layer.cornerRadius = 5.0;
    
    goShoppingBtn.layer.masksToBounds = YES;
    
    [goShoppingBtn addTarget:self action:@selector(jumpToController:) forControlEvents:UIControlEventTouchUpInside];
    
    [self addSubview:goShoppingBtn];
    
    
    //MARK:布局
    [shopEmptView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.mas_centerY);
        make.centerX.equalTo(self);
        make.size.mas_equalTo(CGSizeMake(90, 90));
    }];
    
    
    [reminderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(shopEmptView.mas_bottom).offset(20);
        make.left.offset(50);
        make.right.offset(-50);
    }];
    
    [goShoppingBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(reminderLabel.mas_bottom).offset(18);
        make.size.mas_equalTo(CGSizeMake(145, 30));
        make.centerX.equalTo(shopEmptView);
    }];
}
- (void)jumpToController:(UIButton *)sender
{
    if ([self.delegate respondsToSelector:@selector(jumpToMainHomeController:)]){
        [self.delegate jumpToMainHomeController:sender];
    }
}


@end
